home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / usr / share / pyshared / DistUpgrade / theme-switch-helper.py < prev    next >
Text File  |  2009-11-02  |  2KB  |  50 lines

  1. #!/usr/bin/python
  2. #
  3. # This is a helper for the ReleaseUpgrader. it will need to be called
  4. # like this:
  5. # os.system("sudo -u %s theme-switch-helper.py", os.environ["SUDO_USER"])
  6. # to make sure that it is run in the users session
  7.  
  8. import gconf
  9. import subprocess
  10. from optparse import OptionParser
  11.  
  12.  
  13. parser = OptionParser()
  14. parser.add_option("-g", "--get", action="store_true", dest="get",
  15.                   help="get the current gnome/gtk theme settings")
  16. parser.add_option("-s", "--set", dest="set", 
  17.                   help="set the current gnome/gtk theme settings")
  18. parser.add_option("-d", "--defaults", dest="defaults", action="store_true",
  19.                   help="set gtk/gnome settings to save defaults")
  20. (options, args) = parser.parse_args()
  21.  
  22. client = gconf.client_get_default()
  23.  
  24. if options.get:
  25.     # get current settings
  26.     gtk_theme = client.get_string("/desktop/gnome/interface/gtk_theme")
  27.     icon_theme = client.get_string("/desktop/gnome/interface/icon_theme")
  28.     metacity_theme = client.get_string("/apps/metacity/general/theme")
  29.     print gtk_theme
  30.     print icon_theme
  31.     print metacity_theme
  32.  
  33. if options.defaults:
  34.     # set to save defaults
  35.     client.set_string("/desktop/gnome/interface/gtk_theme","Human")
  36.     client.set_string("/desktop/gnome/interface/icon_theme","Human")
  37.     client.set_string("/apps/metacity/general/theme","Human")
  38.  
  39. if options.set:
  40.     (gtk_theme, icon_theme, metacity_theme) = open(options.set).read().strip().split("\n")
  41.     print gtk_theme
  42.     print icon_theme
  43.     print metacity_theme
  44.     client.set_string("/desktop/gnome/interface/gtk_theme", gtk_theme)
  45.     client.set_string("/desktop/gnome/interface/icon_theme", icon_theme)
  46.     client.set_string("/apps/metacity/general/theme", metacity_theme)
  47.     
  48.  
  49.